<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>回收</title>
</head>

<body>
  <img id="img" src="https://bookcover.yuewen.com/qdbimg/349573/1027030348/180" alt="">
  <script>
    let eleimage = document.getElementById('img')
    // eleimage.remove()
    // console.log(eleimage);
    // eleimage.parentNode.removeChild(eleimage)

    let storage = {
      arrDom: [eleimage, eleimage.outerHTML]
    }

    // 手动回收内存的方法
    // eleimage = null
    eleimage.outerHTML = null
    eleimage = null
    console.log(eleimage);
    storage.arrDom[0] = null
    console.log(storage.arrDom[0]);

    // setTimeout(() => {
    //   document.body.appendChild(storage.arrDom[0])
    // }, 2000);
  </script>
</body>

</html>